<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


//前台首页
Route::get('/', 'HomeController@index');


//前台商品列表
Route::get('/list', 'HomeController@list');

//前台商品详情
Route::get('/detail/{id}', 'HomeController@details');

//前台搜索详情
Route::get('/search', 'SearchController@index');

//添加购物车
Route::get('/join/{id}', 'CartController@insert');
//前台购物车页面
Route::get('/cart', 'HomeController@cart');

//删除购物车
Route::get('/cart/delete/{id}','HomeController@cartDelete');

//将购物车商品放入收藏
Route::get('/cart/coll/{id}','HomeController@coll');

//生成订单
Route::get('/cart/order','HomeController@order');

//前台结算页面
Route::get('/pay', 'HomeController@pay');

//前台结算页面
Route::get('/success', 'HomeController@success');

// 前台认证路由...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// 前台注册路由...
Route::get('/auth/register', 'Auth\AuthController@getRegister');
Route::post('/auth/register', 'Auth\AuthController@postRegister');

Route::get('/profile','UsersController@profile');


/**
* 前台用户中心
*/
Route::get('/person', 'PersonController@index');


//前台用户中心接收商品收藏 获取更多的 ajax请求
Route::get('/person/moreAjax','PersonController@moreAjax');

//前台用户资料
Route::get('/person/info', 'PersonController@info');

//前台用户资料修改
Route::post('/person/info', 'PersonController@updateInfo');

//前台用户安全设置
Route::get('/person/safe', 'PersonController@safe');

//安全中心修改密码
Route::get('/person/password','PersonController@password');

//执行修改密码
Route::post('/person/changePass','PersonController@changePass');

//安全中心换绑邮箱
Route::get('/person/email','PersonController@email');

//执行修改邮箱
Route::post('/person/changeEmail','PersonController@changeEmail');

//前台用户地址管理
Route::get('/person/address', 'PersonController@address');

//新增收货地址
Route::post('/person/addAddress','PersonController@addAddress');

//显示编辑修改收货地址页面
Route::get('/person/edit/{id}','PersonController@edit');
//执行收货地址修改
Route::post('/person/doEdit/{id}','PersonController@doEdit');
//接收设默认地址发送的ajax请求
Route::get('/person/default/{id}','PersonController@default');
//执行删除收货地址
Route::get('/person/delAddress/{id}','PersonController@delAddress');

//前台用户订单管理
Route::get('/person/order', 'PersonController@order');
//前台生成订单
Route::get('/person/createOrder','PersonController@createOrder');

//前台用户订单详情
Route::get('/person/orderinfo/{id}', 'PersonController@orderinfo');

//确认收货
Route::get('/person/shouhuo/{id}','PersonController@shouhuo');

//前台用户退换货
Route::get('/person/change', 'PersonController@change');

//前台用户优惠券
Route::get('/person/coupon', 'PersonController@coupon');

//用户删除优惠券
Route::get('/person/delCoupon/{id}','PersonController@delCoupon');

//前台用户红包
Route::get('/person/bonus', 'PersonController@bonus');

//前台用户账单明细
Route::get('/person/bill', 'PersonController@bill');

//前台用户收藏
Route::get('/person/collection', 'PersonController@collection');

//取消用户收藏
Route::get('/person/cancel','PersonController@cancel');

//将收藏商品加入购物车
Route::get('/person/cart/{id}','PersonController@cart');

//前台用户足迹
Route::get('/person/foot', 'PersonController@foot');

//前台用户评价
Route::get('/person/comment', 'PersonController@comment');

//前台用户消息
Route::get('/person/news', 'PersonController@news');

//删除指定的购物车商品
Route::get('/cart/delete', 'CartController@delete');

//网站后台登录
Route::get('/admin/login','Admins\LoginController@login');
Route::post('/admin/login','Admins\LoginController@dologin');

//前台申请商家入驻
Route::controller('/apply', 'Shop\ApplyController');


//商家后台
Route::get('/shop/login', 'Shop\LoginController@index');
Route::post('/shop/login', 'Shop\LoginController@doLogin');
//获取验证码
Route::get('/img', 'Shop\CaptchaBuilder@captcha');
//商家路由组
Route::group(['middleware'=>'shop'], function(){
	//用户退出登录
	Route::get('/shop/logout', 'Shop\LoginController@logout');
	//商家管理商铺
	Route::controller('/shop', 'Shop\ShopController');
	//管理商品路由
	Route::controller('/goods', 'Shop\GoodsController');
	//管理店铺订单
	Route::controller('/sporder', 'Shop\OrderController');
	//管理优惠券
	Route::controller('/coupon','CouponController');
});



//前台商家店铺页面
Route::controller('/home/shop', 'Shop\HomeController');

//网站后台登录路由中间件
Route::group(['middleware'=>'login'],function(){
	//退出登录
	Route::get('/admin/logout','Admins\LoginContrroller@logout');

	//后台商家管理
	Route::controller('/admin/shop', 'ShopsController');
	
	//后台商品分类管理
	Route::controller('/cate', 'CateController');

	//后台品牌管理
	Route::controller('/brank', 'BrankController');

	//后台友情链接管理
	Route::controller('/admin/links', 'LinksController');
	

	//后台订单管理
	Route::resource('/admin/order', 'OrderController');

	//网站后台主页
	Route::get('/admin',function(){
		return view('/webadmin.index');
	});

	//网站后台用户管理
	Route::resource('/admin/user','UserController');

	// 网站配置
	Route::Controller('/admin/config','Admins\ConfigController');
		
});
